package com.gupaoedu.vip.singleton;

import com.sun.tools.internal.xjc.model.CClass;

import java.lang.reflect.Constructor;

import static sun.org.mozilla.javascript.internal.ScriptRuntime.ClassClass;

/**
 * Created by zhaozhonghai on 2017/5/24.
 */
public class SingletonTest{
    public static void main(String[] args){
        try {
            //不能用反射 破坏规则 既然用了单例模式 就要保证入口唯一
//            Class clazz=Class.forName("com.gupaoedu.vip.singleton.Sun");
//            Constructor<Sun> construtor=clazz.getDeclaredConstructor(null);
//            construtor.setAccessible(true);
//            Sun sun = construtor.newInstance();
//            System.out.println(sun==Sun.getInstance());
            Sun sun=Sun.getInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
